<template>
  <div>
    <CmsPreviewApp :data="state.data"/>
    <nuxt-welcome class="nuxt-welcome"/>
  </div>
</template>

<script setup>
import {CmsPreviewApp} from "../cms/Preview";

const route = useRoute()
const id = route.query.code
const state = reactive({
  data: null
})
if (!!id) {
  const {data} = await useAsyncData(id, async () => {
    const {result} = await $fetch('http://1.116.13.72:7001/cms/item', {method: 'post', body: {id}})
    return result
  })

  state.data = JSON.parse(data.value.json)
}
</script>

<style lang="scss">
html, body {
  margin: 0;
  padding: 0;
}
</style>
